const protecteds = Symbol();
class Common {
  constructor() {
    this[protecteds] = {};

    // [protecteds] Cannot convert a Symbol value to a string
    Object.defineProperty(this, protecteds, {
      value: {},
      enumerable: false,
      // configurable: false
    })

    this[protecteds].host = "https://houdunren.com";

  }
  set host(url) {
    if (!/^https?:/i.test(url)) {
      throw new Error("非常网址");
    }
    this[protecteds].host = url;
  }
  get host() {
    return this[protecteds].host;
  }
}
class User extends Common {
  constructor(name) {
    super();
    this[protecteds].name = name;
  }
  get name() {
    return this[protecteds].name;
  }
}
let hd = new User("后盾人");
hd.host = "https://www.hdcms.com";
// console.log(hd[Symbol()]);
console.log(hd.name);
console.log(hd);
console.log(Object.getOwnPropertyDescriptor(hd, protecteds))
